<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* 图片用内边框是会失效的 */
    /* img {
      box-shadow: inset 0 0 0 10px skyblue;
    } */


    /* border没能够显示出来 */
    .box {
      width: 300px;
      box-shadow: inset 0 0 0 10px red;
      box-sizing: border-box;
    }
    img {
      /* 添加定位，z-index: -1;才能看到.box的内边框 */
      position: relative;
      z-index: -1;
      display: block;
      max-width: 100%;
      object-fit: cover;
      object-position: center;
      border-style: none;
    }
  </style>
</head>
<body>
  <div class="box">
    <img src="./image/1.png" alt="">
  </div>
</body>
</html> 